package tech.treec.smartlight;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.young.mylib.utils.Utils;

import static android.content.Context.MODE_PRIVATE;

/**
 * Created by Young on 2017/5/17.
 */

public class Constants {
    public final static String AppPath = Utils.getSDPath() + "/BillBoard/";
    public final static String TfCardAppPath = "/mnt/extsd/BillBoard/";
    public final static String ConfigFileName = "Config.json";

    public static final String ACTION_LINKAGE_CONFIG_RECEIVE = "ACTION_LINKAGE_CONFIG_RECEIVE";//场景配置的消息到达
    public static final String ACTION_BASE_RECEIVE = "TECH_TREEC_ACTION_BASE_RECEIVE";//基类里处理事务的消息
    public final static int ACTION_MQTT_RESTART_SERVICE = 10086;//基类里重启MQTT服务

    public final static String DEVICE_TYPE_LIGHT = "照明", DEVICE_TYPE_BODY = "人体感应器", DEVICE_TYPE_AIR = "空调";

    public final static String ACTION_MQTT_SUB_MSG = "ACTION_MQTT_SUB_MSG";//MQTT订阅消息
    public final static String ACTION_MQTT_SUB_MSG_RECEIVE = "ACTION_MQTT_SUB_MSG_RECEIVE";//接收MQTT订阅消息
    public final static String ACTION_MQTT_PUB_MSG = "ACTION_MQTT_PUB_MSG";//MQTT发送消息
    public final static String ACTION_MQTT_CONNECTED = "ACTION_MQTT_CONNECTED";//MQTT连接成功的消息
    public final static String ACTION_REQUEST_LINKAGE_CONFIG = "ACTION_REQUEST_LINKAGE_CONFIG";//请求场景配置

    /**
     * mqtt
     */
    public final static String broker = "127.0.0.1";
    //  public final static String broker = "192.168.1.6";
    public final static int mqttport = 1883;
    /**
     * 保存的MQTT IP&PORT
     */
    public final static String MQTT_BROKER = "com.young.billboard.utils.MQTT_BROKER";
    public final static String MQTT_BROKER_PORT = "com.young.billboard.utils.MQTT_BROKER_PORT";
    /**
     * Mqtt超时重发
     */
    public final static long MQTT_TIMEOUT_TIME = 6000;
    /**
     * TOPIC的前缀名
     */

    public final static String TOPIC_PREFIX = "BILL_BOARD_TOPIC_";

    /**
     * mqtt服务注册receive
     * 1、登录后SUB TOPIC
     * 2、PUB信息到TOPIC
     */
    public final static String MSG_MQTTSERVICE_MSG_FLAG = "MSG_MQTTSERVICE_MSG_FLAG";
    public final static int MSG_MQTTSERVICE_SUB_TOPIC = 0, MSG_MQTTSERVICE_PUB_MSG = 1;
    public final static String MSG_MQTTSERVICE_SENDMSG = "MSG_MQTTSERVICE_SENDMSG";


    /**
     * adjust webview size
     */

    public final static int zoomNum = 10;
    public final static int moveNum = 5;

    /**
     * SharedPreferences
     */
    public final static String MARGIN_LEFT = "MARGIN_LEFT";
    public final static String MARGIN_RIGHT = "MARGIN_RIGHT";
    public final static String MARGIN_TOP = "MARGIN_TOP";
    public final static String MARGIN_BOTTOM = "MARGIN_BOTTOM";
    public final static String WEB_WIDTH = "WEB_WIDTH";
    public final static String WEB_HEIGHT = "WEB_HEIGHT";

    /**
     * 本地存储
     */
    public static SharedPreferences getPreferences(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context);
    }
}
